package net.hserver.gateway.dispatch;

import cn.hserver.core.ioc.annotation.Bean;
import cn.hserver.core.ioc.annotation.Order;
import cn.hserver.plugin.web.protocol.DispatchHttp;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import net.hserver.gateway.GateWayStartApp;

import java.net.InetSocketAddress;

@Order(3)
@Bean
public class DispatchGateWayServerHttp extends DispatchHttp {

    @Override
    public boolean dispatcher(ChannelHandlerContext ctx, ChannelPipeline pipeline, byte[] headers) {
        InetSocketAddress socketAddress = (InetSocketAddress) ctx.channel().localAddress();
        int port = socketAddress.getPort();
        if (port != 9999) {
            return false;
        }
        return super.dispatcher(ctx, pipeline, headers);
    }
}
